package com.ukao.pad.dialog;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.ukao.pad.R;
import com.ukao.pad.base.BaseDialogFragment;
import com.ukao.pad.utils.CheckUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;


public class DownloadDialogFragment extends BaseDialogFragment {

    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    @BindView(R.id.edit_name_cancel)
    Button editNameCancel;
    @BindView(R.id.edit_name_submit)
    Button editNameSubmit;
    Unbinder unbinder;
    @BindView(R.id.progressBar)
    TextView progressBar;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;
    private String filePath;


    public static DownloadDialogFragment newInstance(String param1, String param2) {
        DownloadDialogFragment fragment = new DownloadDialogFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_download_dialog, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initView();
    }





    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.edit_name_cancel, R.id.edit_name_submit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.edit_name_cancel:
                dismiss();
                break;
            case R.id.edit_name_submit:
                if (!CheckUtils.isNull(mOnConfirmClickListener)){
                    mOnConfirmClickListener.onChildItemClick(R.id.edit_name_submit,"");
                }
                dismiss();
                break;
        }
    }



}
